<%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage<CodeCampServerLite.UI.Models.ConferenceShowModel>" MasterPageFile="~/Views/Shared/Site.Master" %>
<asp:Content runat="server" ID="Content" ContentPlaceHolderID="TitleContent">
	Show
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="Scripts" runat="server">
<% if (false) { %>
    <script src="../../Scripts/jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
<% } %>
<script language="javascript" type="text/javascript">

    $(function () {
        $('#showAttendees').click(function () {

            var url = '<%= Url.Action("Show", "Attendee", new { confname = Model.Name }) %>';

            // Keep a reference to the show attendees button for later
            var button = $(this);

            var callback = function (data, textStatus) {

                // Place HTML returned from AJAX inside special p tag below
                $('#attendees').html(data);

                // Hide the show attendees button
                button.hide();
            };

            // Issue an AJAX GET, to return HTML (and not JSON)
            $.get(url, null, callback, 'html');
        });
    });

</script>
</asp:Content>

<asp:Content runat="server" ID="Content1" ContentPlaceHolderID="MainContent">

    <h2><%: Model.Name %></h2>

	<p>
		<%= Html.ActionLink("Register for this Conference", "Register", new { confname = Model.Name })%>
	</p>

    <table>
        <tr><th>Speaker</th><th>Title</th></tr><% for (var i = 0; i < Model.Sessions.Length; i++) { var count = i; %>
        <tr>
            <td><%: Html.DisplayFor(m => m.Sessions[count].SpeakerFirstName) %>
				<%: Html.DisplayFor(m => m.Sessions[count].SpeakerLastName) %>
			</td>
            <td><%: Html.DisplayFor(m => m.Sessions[count].Title) %></td>
        </tr><%} %> 
    </table>

    <button id="showAttendees">Show Attendees</button>
    <p id="attendees">
    </p>

</asp:Content>
